//
//  LPCSystemDefine.h
//  WalkUp
//
//  Created by 李沛池 on 16/10/19.
//  Copyright © 2016年 LPC. All rights reserved.
//

#ifndef LPCSystemDefine_h
#define LPCSystemDefine_h


// 获取沙盒
#define DOCUMENT_PATH NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES)[0]

// 获取系统版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define CURRENTSYSTEM_VERSION [[UIDevice currentDevice] systemVersion]
// 获取系统唯一标示符
#define DEVICESERIAL_NO [[[UIDevice currentDevice] identifierForVendor] UUIDString]

//系统版本是否大于8.0
#define ISIOS8 ([UIDevice currentDevice].systemVersion.doubleValue >= 8.0)

// 判断是否 Retina屏、设备是否Iphone 5、是否是iPad
#define ISRETINA ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define IPHONE5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define ISPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)


// 检查系统版本
#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

// 从AppStore获取应用信息和下载地址
#define APP_INFO(v)     [NSString stringWithFormat:@"http://itunes.apple.com/lookup?id=%@",v]
#define APP_DOWNLOAD(v) [NSString stringWithFormat:@"http://itunes.apple.com/app/id%@",v]


#endif /* LPCSystemDefine_h */
